package com.hanter.demo.raddemo;

import android.os.Bundle;

import com.hanter.android.radui.mvp.MvpTitleBarActivity;
import com.hanter.android.radwidget.cupertino.CupertinoTabBar;
import com.hanter.android.radwidget.cupertino.TabContainer;
import com.hanter.demo.raddemo.tab.OneFragment;
import com.hanter.demo.raddemo.tab.ThreeFragment;
import com.hanter.demo.raddemo.tab.TwoFragment;

public class TabBarActivity extends MvpTitleBarActivity<TabBarContract.View, TabBarContract.Presenter>
        implements TabBarContract.View {

    @Override
    protected int getLayout() {
        return R.layout.activity_tab_bar;
    }

    @Override
    public TabBarContract.Presenter createPresenter() {
        return new TabBarPresenter();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

//        List<TabBarItem> items = new ArrayList<>();
//        items.add(new TabBarItem(R.mipmap.ic_launcher, "test1", "1"));
//        items.add(new TabBarItem(R.mipmap.ic_launcher, "test2", "2"));
//        items.add(new TabBarItem(R.mipmap.ic_launcher, "test3", "3"));


        TabContainer tabContainer = findViewById(R.id.tabContainer);
        CupertinoTabBar tabBar = findViewById(R.id.tabBar);

        tabBar.addTab(R.drawable.ic_tab_home, "test1", "1");
        tabBar.addTab(R.mipmap.ic_launcher, "test2", "2");
        tabBar.addTab(R.mipmap.ic_launcher, "test3", "3");

        tabContainer.addTab("1", OneFragment.class, null);
        tabContainer.addTab("2", TwoFragment.class, null);
        tabContainer.addTab("3", ThreeFragment.class, null);

        tabContainer.setup(getSupportFragmentManager());

        tabContainer.bindTabBar(tabBar);

        tabBar.setupBlur(findViewById(android.R.id.content));
    }

}
